#include "dockfactory.h"

#include <memory>

#include "docktab.h"
#include "docktabbar.h"
#include "docktitlebar.h"
#include "dockwidget.h"
#include "dockpannel.h"

QADS_BEGIN_NAMESPACE

static std::unique_ptr<DockFactory> DefaultFactory(new DockFactory());


//============================================================================
DockTab* DockFactory::createDockTab(DockWidget* DockWidget) const
{
    return new DockTab(DockWidget);
}


//============================================================================
DockTabBar* DockFactory::createDockTabBar(DockPannel* DockArea) const
{
    return new DockTabBar(DockArea);
}


//============================================================================
DockTitleBar* DockFactory::createDockTitleBar(DockPannel* DockArea) const
{
    return new DockTitleBar(DockArea);
}


//============================================================================
const DockFactory* DockFactory::factory()
{
    return DefaultFactory.get();
}


//============================================================================
void DockFactory::setFactory(DockFactory* Factory)
{
    DefaultFactory.reset(Factory);
}


//============================================================================
void DockFactory::resetDefaultFactory()
{
    DefaultFactory.reset(new DockFactory());
}

QADS_END_NAMESPACE
